class Bank {
public:
    map<int, long long> accounts;
    set<int> isExist;
    Bank(vector<long long>& balance) {
        for(int i=0; i<balance.size(); i++)
            accounts[i+1]=balance[i], isExist.insert(i+1);
    }
    
    bool transfer(int account1, int account2, long long money) { //account1-(money)->account2
        if(accounts[account1]<money||!isExist.contains(account1)||!isExist.contains(account2)) return false;
        accounts[account1]-=money;
        accounts[account2]+=money;
        return true;
    }
    
    bool deposit(int account, long long money) {
        if(!isExist.contains(account)) return false;
        accounts[account]+=money;
        return true;
    }
    
    bool withdraw(int account, long long money) {
        if(accounts[account]<money||!isExist.contains(account)) return false;
        accounts[account]-=money;
        return true;
    }
};

/**
 * Your Bank object will be instantiated and called as such:
 * Bank* obj = new Bank(balance);
 * bool param_1 = obj->transfer(account1,account2,money);
 * bool param_2 = obj->deposit(account,money);
 * bool param_3 = obj->withdraw(account,money);
 */